package com.cqie.hospitalescort.controller;

import com.cqie.hospitalescort.entity.PatientInfo;
import com.cqie.hospitalescort.model.Result;
import com.cqie.hospitalescort.service.PatientInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gdy
 * @since 2025-02-18
 */
@RestController
@RequestMapping("/patientInfo")
@Api(value = "就诊人管理", tags = {"就诊人管理"})
public class PatientInfoController extends BaseController {

    @Autowired
    private PatientInfoService patientInfoService;

    @GetMapping("/list")
    @ApiOperation(value = "就诊人列表",httpMethod = "GET")
    public Result<List<PatientInfo>> getPatientInfo(){
        return response(patientInfoService.getPatientInfo());
    }

    @PostMapping("/save")
    @ApiOperation(value = "新增、修改 就诊人",httpMethod = "POST")
    public Result<Void> savePatientInfo(@RequestBody PatientInfo patientInfo){
        patientInfoService.savePatientInfo(patientInfo);
        return response();
    }

    @DeleteMapping("/delete/{id}")
    @ApiOperation(value = "删除就诊人",httpMethod = "DELETE")
    public Result<Void> deletePatientInfoById(@PathVariable Long id){
        patientInfoService.deletePatientInfoById(id);
        return response();
    }

}
